﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class DialogShow : MonoBehaviour
{
    [Header("按钮")]
    public Button buttonOK;
    [Header("文本控件")]
    public Text text;
    [Header("提示对象")]
    public GameObject dialog;

    private bool isFist = false;


    
    void Start()
    {
        if (!isFist)
        {
            if (dialog)
            {
                dialog.SetActive(false);
            }
        }
    }


    public void Show(string txt, bool isSelfClose)
    {
        isFist = true;
        //Debug.Log("对话框，空1");
        if (text && dialog)
        {
            //Debug.Log("对话框，空2");
            text.text = txt;
            dialog.SetActive(true);
        }
        else
        {
            //Debug.Log("对话框，空");
        }
        if (buttonOK)
        {
            buttonOK.interactable = isSelfClose;
        }
    }
}
public class DialogShowMsg
{
    /// <summary>
    /// 更新UI暂存的消息
    /// </summary>
    public string dialogStr = "";
    /// <summary>
    /// 是否自动关闭
    /// </summary>
    public bool isSelfCloes = false;
}